
let trs = document.querySelectorAll("tbody tr");

let table = document.querySelector("table");

for (let item of trs) {
    item.onmouseover = function () {
        this.classList.add("active");
    }

    item.onmouseout = function () {
        this.classList.remove("active");
    }
}

let dels = document.querySelectorAll(".del");

for (let item of dels) {
    item.onclick = function () {
        // console.log(this.parentElement);
        // let tr = this.parentNode.parentNode;
        // table.removeChild(tr);

        let name = this.parentNode.previousElementSibling.previousElementSibling.innerText;

        if (confirm("确定要删除【" + name + "】吗？")) {
            let tr = this.parentNode.parentNode;
            tr.remove();
        }
    }
}

// let imgs = ["1.jpg", "2.png", "3.jpeg", "4.svg"];

// let timer = setInterval(function () {
//     let index = parseInt(Math.random() * imgs.length);
//     img.src = imgs[index];
// }, 1000);
